﻿<div class="top-row ps-3 navbar navbar-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="">LuckyFish的Blog</a>
        <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
            <span class="navbar-toggler-icon"></span>
        </button>
    </div>
</div>

<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
    <nav class="flex-column">
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <i class="oi oi-home" aria-hidden="true"></i> 主页
            </NavLink>
            <NavLink class="nav-link" href="/Date" Match="NavLinkMatch.All">
                <i class="oi oi-calendar" aria-hidden="true"></i> 归档
            </NavLink>
            <NavLink class="nav-link" href="/List" Match="NavLinkMatch.All">
                <i class="oi oi-list" aria-hidden="true"></i> 文章列表
            </NavLink>
            <NavLink class="nav-link" href="/Label" Match="NavLinkMatch.All">
                <i class="fa-solid fa-notes-medical" style="margin-right: 18px" aria-hidden="true"></i> 标签
            </NavLink>
            <AuthorizeView>
                <Authorized>
                    <NavLink class="nav-link" href="/Admin" Match="NavLinkMatch.All">
                        <i class="fa-solid fa-notes-medical" style="margin-right: 18px" aria-hidden="true"></i> 管理员界面
                    </NavLink>
                </Authorized>
            </AuthorizeView>
        </div>
    </nav>
</div>

@code {
    private bool collapseNavMenu = true;

    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }

}

<style>
    .nav-link{
        margin-top: 2px;
        padding-left: 4px;
    }
</style>